<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 300px;
            height: 300px;
            background-color: palegoldenrod;
            margin: 30px;
        }
        
        .box1 {
            padding: 30px;
        }
        
        .box2 {
            padding: 30px;
            box-sizing: border-box;
            /* 这个不是普通的外加，而是自动内减，不管加边框都不会改变 */
            border: 10px solid saddlebrown;
        }
    </style>
</head>

<body>
    <div class="box1">这个是往外算的</div>
    <div class="box2">这个是往内算的</div>
</body>

</html>